package demo.log.controller;

import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping("/log")
@RestController
public class LoggerController {
    private static Logger logger = LoggerFactory.getLogger(LoggerController.class);

    @RequestMapping("/print")
    public String print(){
        logger.info("使用日志对象打印日志");
        System.out.println("使用 print 打印日志");
        return "打印成功";
    }

    @RequestMapping("/level")
    public String level(){
        logger.trace("trace 级别日志");
        logger.debug("debug 级别日志");
        logger.info(("info 级别日志"));
        logger.error("error 级别日志");
        return "打印成功";
    }
}
